<template>
	<view class="page-body">
		<u-navbar :title="proxy_name + ' ('+teamCount+')'"></u-navbar>
		
		<view class="mt20">
			<u-cell-group>
				<u-cell-item v-for="(item, index) in userList" :arrow="false" hover-class="none">
					<view slot="icon">
						<u-image width="100rpx" height="100rpx" :src="item.headimgurl?baseUrl+item.headimgurl:'/static/public/images/headimgurl.jpg'" shape="circle">
						</u-image>
					</view>
					<view slot="title" class="u-p-l-20">
						<view class="name">
							{{item.real_name}}
						</view>
						<view class="tel">
							手机号:{{item.mobile}}
						</view>
					</view>
				</u-cell-item>
			</u-cell-group>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				baseUrl: this.config.baseUrl,
				teamCount:0,
				proxy_id: 0,
				type: '',
				userList: {},
				proxy_name: '',
				team_type: 1 //1:推荐团队; 2:拿货团队
			}
		},
		onLoad(options) {
			this.team_type = options.team_type;
			this.proxy_name = options.proxy_name;
			this.proxy_id = options.proxy_id;
			this.type = options.type;
			
			this.getUserList();
		},
		methods: {
			getUserList() {
				
				let url = '';
				let data = {};
				if(this.team_type == 1){
					url = 'channel/api.team/getTeamUserList';
					data = {
						type: this.type,
						proxy_id: this.proxy_id
					}
				}else{
					url = 'channel/api.team/getPurchaseUserList';
					data = {
						proxy_id: this.proxy_id
					}
				}
				
				let userList = this.userList;
				if (userList.length > 0) {
					this.$forceUpdate()
					return false;
				}
				
				this.$u.post(url, data).then(res => {
					this.userList = res.data;
					this.teamCount = this.userList.length
				})
			}
		}
	}
</script>

<style lang="scss">
	.page-body{
		height: calc(100% - 40px);
	}
	.swiper-box{
		height: 100%;
	}
	.top_box{
		margin-top: 50rpx;
		width: 100%;
		height: 500rpx;
		background-size: 100%;
		position: relative;
		background-color: #ffffff;
		.headimgurl {
			position: absolute;
			top:200rpx;
			left: 100rpx;
			width: 150rpx;
			height: 150rpx;
			overflow: hidden;
			margin-left: 20rpx;
			border-radius: 50%;
			border: 3rpx solid #cccccc;
		}
	}
	.info{
		background-color: #ffffff;
		padding: 80rpx;
		.name{
			display: block;
			font-size: 35rpx;
			font-weight: 700;
			line-height: 60rpx;
		}
		.level{
			font-size: 18rpx;
			color: $base-color;
			border-radius: 10rpx;
			padding: 1rpx 10rpx;
			border: 1rpx solid $base-color
		}
	}
	
	.name{
		font-size: 28rpx;
		font-weight: 500;
		color: #333333;
	}
	.tel{
		font-size: 24rpx;
		font-weight: 400;
		color: #999999;
	}
</style>
